Left Termination of the query pattern
sum_in_3(g, a, g)
w.r.t. the given Prolog program could successfully be proven:
↳ Prolog
↳ PrologToPiTRSProof
Clauses:
sum([], [], []).
sum(.(X1, Y1), .(X2, Y2), .(X3, Y3)) :- ','(add(X1, X2, X3), sum(Y1, Y2, Y3)).
add(0, X, X).
add(s(X), Y, s(Z)) :- add(X, Y, Z).
Queries:
sum(g,a,g).
We use the technique of [30].Transforming Prolog into the following Term Rewriting System:
Pi-finite rewrite system:
The TRS R consists of the following rules:
sum_in(.(X1, Y1), .(X2, Y2), .(X3, Y3)) → U1(X1, Y1, X2, Y2, X3, Y3, add_in(X1, X2, X3))
add_in(s(X), Y, s(Z)) → U3(X, Y, Z, add_in(X, Y, Z))
add_in(0, X, X) → add_out(0, X, X)
U3(X, Y, Z, add_out(X, Y, Z)) → add_out(s(X), Y, s(Z))
U1(X1, Y1, X2, Y2, X3, Y3, add_out(X1, X2, X3)) → U2(X1, Y1, X2, Y2, X3, Y3, sum_in(Y1, Y2, Y3))
sum_in([], [], []) → sum_out([], [], [])
U2(X1, Y1, X2, Y2, X3, Y3, sum_out(Y1, Y2, Y3)) → sum_out(.(X1, Y1), .(X2, Y2), .(X3, Y3))
The argument filtering Pi contains the following mapping:
sum_in(x1, x2, x3) = sum_in(x1, x3)
.(x1, x2) = .(x1, x2)
U1(x1, x2, x3, x4, x5, x6, x7) = U1(x2, x6, x7)
add_in(x1, x2, x3) = add_in(x1, x3)
s(x1) = s(x1)
U3(x1, x2, x3, x4) = U3(x4)
0 = 0
add_out(x1, x2, x3) = add_out(x2)
U2(x1, x2, x3, x4, x5, x6, x7) = U2(x3, x7)
[] = []
sum_out(x1, x2, x3) = sum_out(x2)
Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog
↳ Prolog
↳ PrologToPiTRSProof
↳ PiTRS
↳ DependencyPairsProof
Pi-finite rewrite system:
The TRS R consists of the following rules:
sum_in(.(X1, Y1), .(X2, Y2), .(X3, Y3)) → U1(X1, Y1, X2, Y2, X3, Y3, add_in(X1, X2, X3))
add_in(s(X), Y, s(Z)) → U3(X, Y, Z, add_in(X, Y, Z))
add_in(0, X, X) → add_out(0, X, X)
U3(X, Y, Z, add_out(X, Y, Z)) → add_out(s(X), Y, s(Z))
U1(X1, Y1, X2, Y2, X3, Y3, add_out(X1, X2, X3)) → U2(X1, Y1, X2, Y2, X3, Y3, sum_in(Y1, Y2, Y3))
sum_in([], [], []) → sum_out([], [], [])
U2(X1, Y1, X2, Y2, X3, Y3, sum_out(Y1, Y2, Y3)) → sum_out(.(X1, Y1), .(X2, Y2), .(X3, Y3))
The argument filtering Pi contains the following mapping:
sum_in(x1, x2, x3) = sum_in(x1, x3)
.(x1, x2) = .(x1, x2)
U1(x1, x2, x3, x4, x5, x6, x7) = U1(x2, x6, x7)
add_in(x1, x2, x3) = add_in(x1, x3)
s(x1) = s(x1)
U3(x1, x2, x3, x4) = U3(x4)
0 = 0
add_out(x1, x2, x3) = add_out(x2)
U2(x1, x2, x3, x4, x5, x6, x7) = U2(x3, x7)
[] = []
sum_out(x1, x2, x3) = sum_out(x2)
Using Dependency Pairs [1,30] we result in the following initial DP problem:
Pi DP problem:
The TRS P consists of the following rules:
SUM_IN(.(X1, Y1), .(X2, Y2), .(X3, Y3)) → U11(X1, Y1, X2, Y2, X3, Y3, add_in(X1, X2, X3))
SUM_IN(.(X1, Y1), .(X2, Y2), .(X3, Y3)) → ADD_IN(X1, X2, X3)
ADD_IN(s(X), Y, s(Z)) → U31(X, Y, Z, add_in(X, Y, Z))
ADD_IN(s(X), Y, s(Z)) → ADD_IN(X, Y, Z)
U11(X1, Y1, X2, Y2, X3, Y3, add_out(X1, X2, X3)) → U21(X1, Y1, X2, Y2, X3, Y3, sum_in(Y1, Y2, Y3))
U11(X1, Y1, X2, Y2, X3, Y3, add_out(X1, X2, X3)) → SUM_IN(Y1, Y2, Y3)
The TRS R consists of the following rules:
sum_in(.(X1, Y1), .(X2, Y2), .(X3, Y3)) → U1(X1, Y1, X2, Y2, X3, Y3, add_in(X1, X2, X3))
add_in(s(X), Y, s(Z)) → U3(X, Y, Z, add_in(X, Y, Z))
add_in(0, X, X) → add_out(0, X, X)
U3(X, Y, Z, add_out(X, Y, Z)) → add_out(s(X), Y, s(Z))
U1(X1, Y1, X2, Y2, X3, Y3, add_out(X1, X2, X3)) → U2(X1, Y1, X2, Y2, X3, Y3, sum_in(Y1, Y2, Y3))
sum_in([], [], []) → sum_out([], [], [])
U2(X1, Y1, X2, Y2, X3, Y3, sum_out(Y1, Y2, Y3)) → sum_out(.(X1, Y1), .(X2, Y2), .(X3, Y3))
The argument filtering Pi contains the following mapping:
sum_in(x1, x2, x3) = sum_in(x1, x3)
.(x1, x2) = .(x1, x2)
U1(x1, x2, x3, x4, x5, x6, x7) = U1(x2, x6, x7)
add_in(x1, x2, x3) = add_in(x1, x3)
s(x1) = s(x1)
U3(x1, x2, x3, x4) = U3(x4)
0 = 0
add_out(x1, x2, x3) = add_out(x2)
U2(x1, x2, x3, x4, x5, x6, x7) = U2(x3, x7)
[] = []
sum_out(x1, x2, x3) = sum_out(x2)
ADD_IN(x1, x2, x3) = ADD_IN(x1, x3)
U11(x1, x2, x3, x4, x5, x6, x7) = U11(x2, x6, x7)
U31(x1, x2, x3, x4) = U31(x4)
SUM_IN(x1, x2, x3) = SUM_IN(x1, x3)
U21(x1, x2, x3, x4, x5, x6, x7) = U21(x3, x7)
We have to consider all (P,R,Pi)-chains
↳ Prolog
↳ PrologToPiTRSProof
↳ PiTRS
↳ DependencyPairsProof
↳ PiDP
↳ DependencyGraphProof
Pi DP problem:
The TRS P consists of the following rules:
SUM_IN(.(X1, Y1), .(X2, Y2), .(X3, Y3)) → U11(X1, Y1, X2, Y2, X3, Y3, add_in(X1, X2, X3))
SUM_IN(.(X1, Y1), .(X2, Y2), .(X3, Y3)) → ADD_IN(X1, X2, X3)
ADD_IN(s(X), Y, s(Z)) → U31(X, Y, Z, add_in(X, Y, Z))
ADD_IN(s(X), Y, s(Z)) → ADD_IN(X, Y, Z)
U11(X1, Y1, X2, Y2, X3, Y3, add_out(X1, X2, X3)) → U21(X1, Y1, X2, Y2, X3, Y3, sum_in(Y1, Y2, Y3))
U11(X1, Y1, X2, Y2, X3, Y3, add_out(X1, X2, X3)) → SUM_IN(Y1, Y2, Y3)
The TRS R consists of the following rules:
sum_in(.(X1, Y1), .(X2, Y2), .(X3, Y3)) → U1(X1, Y1, X2, Y2, X3, Y3, add_in(X1, X2, X3))
add_in(s(X), Y, s(Z)) → U3(X, Y, Z, add_in(X, Y, Z))
add_in(0, X, X) → add_out(0, X, X)
U3(X, Y, Z, add_out(X, Y, Z)) → add_out(s(X), Y, s(Z))
U1(X1, Y1, X2, Y2, X3, Y3, add_out(X1, X2, X3)) → U2(X1, Y1, X2, Y2, X3, Y3, sum_in(Y1, Y2, Y3))
sum_in([], [], []) → sum_out([], [], [])
U2(X1, Y1, X2, Y2, X3, Y3, sum_out(Y1, Y2, Y3)) → sum_out(.(X1, Y1), .(X2, Y2), .(X3, Y3))
The argument filtering Pi contains the following mapping:
sum_in(x1, x2, x3) = sum_in(x1, x3)
.(x1, x2) = .(x1, x2)
U1(x1, x2, x3, x4, x5, x6, x7) = U1(x2, x6, x7)
add_in(x1, x2, x3) = add_in(x1, x3)
s(x1) = s(x1)
U3(x1, x2, x3, x4) = U3(x4)
0 = 0
add_out(x1, x2, x3) = add_out(x2)
U2(x1, x2, x3, x4, x5, x6, x7) = U2(x3, x7)
[] = []
sum_out(x1, x2, x3) = sum_out(x2)
ADD_IN(x1, x2, x3) = ADD_IN(x1, x3)
U11(x1, x2, x3, x4, x5, x6, x7) = U11(x2, x6, x7)
U31(x1, x2, x3, x4) = U31(x4)
SUM_IN(x1, x2, x3) = SUM_IN(x1, x3)
U21(x1, x2, x3, x4, x5, x6, x7) = U21(x3, x7)
We have to consider all (P,R,Pi)-chains
The approximation of the Dependency Graph [30] contains 2 SCCs with 3 less nodes.
↳ Prolog
↳ PrologToPiTRSProof
↳ PiTRS
↳ DependencyPairsProof
↳ PiDP
↳ DependencyGraphProof
↳ AND
↳ PiDP
↳ UsableRulesProof
↳ PiDP
Pi DP problem:
The TRS P consists of the following rules:
ADD_IN(s(X), Y, s(Z)) → ADD_IN(X, Y, Z)
The TRS R consists of the following rules:
sum_in(.(X1, Y1), .(X2, Y2), .(X3, Y3)) → U1(X1, Y1, X2, Y2, X3, Y3, add_in(X1, X2, X3))
add_in(s(X), Y, s(Z)) → U3(X, Y, Z, add_in(X, Y, Z))
add_in(0, X, X) → add_out(0, X, X)
U3(X, Y, Z, add_out(X, Y, Z)) → add_out(s(X), Y, s(Z))
U1(X1, Y1, X2, Y2, X3, Y3, add_out(X1, X2, X3)) → U2(X1, Y1, X2, Y2, X3, Y3, sum_in(Y1, Y2, Y3))
sum_in([], [], []) → sum_out([], [], [])
U2(X1, Y1, X2, Y2, X3, Y3, sum_out(Y1, Y2, Y3)) → sum_out(.(X1, Y1), .(X2, Y2), .(X3, Y3))
The argument filtering Pi contains the following mapping:
sum_in(x1, x2, x3) = sum_in(x1, x3)
.(x1, x2) = .(x1, x2)
U1(x1, x2, x3, x4, x5, x6, x7) = U1(x2, x6, x7)
add_in(x1, x2, x3) = add_in(x1, x3)
s(x1) = s(x1)
U3(x1, x2, x3, x4) = U3(x4)
0 = 0
add_out(x1, x2, x3) = add_out(x2)
U2(x1, x2, x3, x4, x5, x6, x7) = U2(x3, x7)
[] = []
sum_out(x1, x2, x3) = sum_out(x2)
ADD_IN(x1, x2, x3) = ADD_IN(x1, x3)
We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.
↳ Prolog
↳ PrologToPiTRSProof
↳ PiTRS
↳ DependencyPairsProof
↳ PiDP
↳ DependencyGraphProof
↳ AND
↳ PiDP
↳ UsableRulesProof
↳ PiDP
↳ PiDPToQDPProof
↳ PiDP
Pi DP problem:
The TRS P consists of the following rules:
ADD_IN(s(X), Y, s(Z)) → ADD_IN(X, Y, Z)
R is empty.
The argument filtering Pi contains the following mapping:
s(x1) = s(x1)
ADD_IN(x1, x2, x3) = ADD_IN(x1, x3)
We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.
↳ Prolog
↳ PrologToPiTRSProof
↳ PiTRS
↳ DependencyPairsProof
↳ PiDP
↳ DependencyGraphProof
↳ AND
↳ PiDP
↳ UsableRulesProof
↳ PiDP
↳ PiDPToQDPProof
↳ QDP
↳ QDPSizeChangeProof
↳ PiDP
Q DP problem:
The TRS P consists of the following rules:
ADD_IN(s(X), s(Z)) → ADD_IN(X, Z)
R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem. From the DPs we obtained the following set of size-change graphs:
- ADD_IN(s(X), s(Z)) → ADD_IN(X, Z)
The graph contains the following edges 1 > 1, 2 > 2
↳ Prolog
↳ PrologToPiTRSProof
↳ PiTRS
↳ DependencyPairsProof
↳ PiDP
↳ DependencyGraphProof
↳ AND
↳ PiDP
↳ PiDP
↳ UsableRulesProof
Pi DP problem:
The TRS P consists of the following rules:
SUM_IN(.(X1, Y1), .(X2, Y2), .(X3, Y3)) → U11(X1, Y1, X2, Y2, X3, Y3, add_in(X1, X2, X3))
U11(X1, Y1, X2, Y2, X3, Y3, add_out(X1, X2, X3)) → SUM_IN(Y1, Y2, Y3)
The TRS R consists of the following rules:
sum_in(.(X1, Y1), .(X2, Y2), .(X3, Y3)) → U1(X1, Y1, X2, Y2, X3, Y3, add_in(X1, X2, X3))
add_in(s(X), Y, s(Z)) → U3(X, Y, Z, add_in(X, Y, Z))
add_in(0, X, X) → add_out(0, X, X)
U3(X, Y, Z, add_out(X, Y, Z)) → add_out(s(X), Y, s(Z))
U1(X1, Y1, X2, Y2, X3, Y3, add_out(X1, X2, X3)) → U2(X1, Y1, X2, Y2, X3, Y3, sum_in(Y1, Y2, Y3))
sum_in([], [], []) → sum_out([], [], [])
U2(X1, Y1, X2, Y2, X3, Y3, sum_out(Y1, Y2, Y3)) → sum_out(.(X1, Y1), .(X2, Y2), .(X3, Y3))
The argument filtering Pi contains the following mapping:
sum_in(x1, x2, x3) = sum_in(x1, x3)
.(x1, x2) = .(x1, x2)
U1(x1, x2, x3, x4, x5, x6, x7) = U1(x2, x6, x7)
add_in(x1, x2, x3) = add_in(x1, x3)
s(x1) = s(x1)
U3(x1, x2, x3, x4) = U3(x4)
0 = 0
add_out(x1, x2, x3) = add_out(x2)
U2(x1, x2, x3, x4, x5, x6, x7) = U2(x3, x7)
[] = []
sum_out(x1, x2, x3) = sum_out(x2)
U11(x1, x2, x3, x4, x5, x6, x7) = U11(x2, x6, x7)
SUM_IN(x1, x2, x3) = SUM_IN(x1, x3)
We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.
↳ Prolog
↳ PrologToPiTRSProof
↳ PiTRS
↳ DependencyPairsProof
↳ PiDP
↳ DependencyGraphProof
↳ AND
↳ PiDP
↳ PiDP
↳ UsableRulesProof
↳ PiDP
↳ PiDPToQDPProof
Pi DP problem:
The TRS P consists of the following rules:
SUM_IN(.(X1, Y1), .(X2, Y2), .(X3, Y3)) → U11(X1, Y1, X2, Y2, X3, Y3, add_in(X1, X2, X3))
U11(X1, Y1, X2, Y2, X3, Y3, add_out(X1, X2, X3)) → SUM_IN(Y1, Y2, Y3)
The TRS R consists of the following rules:
add_in(s(X), Y, s(Z)) → U3(X, Y, Z, add_in(X, Y, Z))
add_in(0, X, X) → add_out(0, X, X)
U3(X, Y, Z, add_out(X, Y, Z)) → add_out(s(X), Y, s(Z))
The argument filtering Pi contains the following mapping:
.(x1, x2) = .(x1, x2)
add_in(x1, x2, x3) = add_in(x1, x3)
s(x1) = s(x1)
U3(x1, x2, x3, x4) = U3(x4)
0 = 0
add_out(x1, x2, x3) = add_out(x2)
U11(x1, x2, x3, x4, x5, x6, x7) = U11(x2, x6, x7)
SUM_IN(x1, x2, x3) = SUM_IN(x1, x3)
We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.
↳ Prolog
↳ PrologToPiTRSProof
↳ PiTRS
↳ DependencyPairsProof
↳ PiDP
↳ DependencyGraphProof
↳ AND
↳ PiDP
↳ PiDP
↳ UsableRulesProof
↳ PiDP
↳ PiDPToQDPProof
↳ QDP
↳ QDPSizeChangeProof
Q DP problem:
The TRS P consists of the following rules:
U11(Y1, Y3, add_out(X2)) → SUM_IN(Y1, Y3)
SUM_IN(.(X1, Y1), .(X3, Y3)) → U11(Y1, Y3, add_in(X1, X3))
The TRS R consists of the following rules:
add_in(s(X), s(Z)) → U3(add_in(X, Z))
add_in(0, X) → add_out(X)
U3(add_out(Y)) → add_out(Y)
The set Q consists of the following terms:
add_in(x0, x1)
U3(x0)
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem. From the DPs we obtained the following set of size-change graphs:
- U11(Y1, Y3, add_out(X2)) → SUM_IN(Y1, Y3)
The graph contains the following edges 1 >= 1, 2 >= 2
- SUM_IN(.(X1, Y1), .(X3, Y3)) → U11(Y1, Y3, add_in(X1, X3))
The graph contains the following edges 1 > 1, 2 > 2